from django_filters import rest_framework

from apps.interfaces.models import Api


class ApiFilter(rest_framework.FilterSet):
    name = rest_framework.CharFilter(lookup_expr='contains')
    project = rest_framework.CharFilter(field_name='service__project')
    module = rest_framework.BaseInFilter(lookup_expr='in')

    class Meta:
        model = Api
        fields = ['name', 'project', 'url', 'method', 'service', 'module']
